<%- include('../includes/head.ejs')%>
    <link rel="stylesheet" href="/css/form.css">
    <link rel="stylesheet" href="/css/product.css">
</head>
<body>
    <%- include('../includes/navigation.ejs')%>
    <main>
      <form class="product-form" action="/admin/<% if(editing) { %>edit-products<% }else { %>add-products<% } %>" method="POST">
       <div class="form-control">
        <label for="title">标题:</label>
           <input type="text" name="title" id="title" value="<% if(editing) { %>product.title<% } %>"/> 
       </div>
       <div class="form-control">
        <label for="imageUrl">图片地址:</label>
           <input type="text" name="imageUrl" id="imageUrl" value="<% if(editing) { %>product.imageUrl <% } %>"/> 
       </div>
       <div class="form-control">
        <label for="price">价格:</label>
           <input type="text" name="price" id="price" step="0.01" value="<% if(editing) { %>product.price <% } %>"/> 
       </div>
       <div class="form-control">
        <label for="description">描述:</label>
        <textarea name="description" id="description"  rows="5" value="<% if(editing) { %>product.description <% } %>"></textarea>
       </div>
       <% if(editing) { %>

        <input type="hidden" name="productId" value="<%= product.id %>">
       <% } %>
       <button type="submit"><% if(editing) { %>编辑产品<% }else { %>添加产品<% } %></button> 
     </form>
    </main>
    <%- include('../includes/end.ejs')%>